package com.kantboot.business.water.repository;

import com.kantboot.business.water.domain.entity.BusWaterVip;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.math.BigDecimal;
import java.util.List;

public interface BusWaterVipRepository extends JpaRepository<BusWaterVip,Long> {


    @Query("""
            FROM BusWaterVip
            ORDER BY needQuota
            """
    )
    List<BusWaterVip> findAll();


    @Query("""
            FROM BusWaterVip
            WHERE needQuota <= :needQuota
            ORDER BY needQuota DESC
            """
    )
    List<BusWaterVip> findByNeedQuotaLessThan(
            @Param("needQuota") BigDecimal needQuota);


    @Query("""
            FROM BusWaterVip
            ORDER BY needQuota DESC
            """
    )
    Page<BusWaterVip> getBodyData(Pageable pageable);


}
